package fields
import (
"github.com/K-Phoen/grabana/timeseries/axis"
"github.com/K-Phoen/sdk"
)
type StackMode string
const (
Unstacked StackMode = "none"
NormalStack StackMode = "normal"
PercentStack StackMode = "percent"
)
type OverrideOption func (field *sdk .FieldConfigOverride )
func Unit (unit string ) OverrideOption {
return func (field *sdk .FieldConfigOverride ) {
field .Properties = append (field .Properties ,
sdk .FieldConfigOverrideProperty {
ID : "unit" ,
Value : unit ,
})
}
}
func FillOpacity (opacity int ) OverrideOption {
return func (field *sdk .FieldConfigOverride ) {
field .Properties = append (field .Properties ,
sdk .FieldConfigOverrideProperty {
ID : "custom.fillOpacity" ,
Value : opacity ,
})
}
}
func FixedColorScheme (color string ) OverrideOption {
return func (field *sdk .FieldConfigOverride ) {
field .Properties = append (field .Properties ,
sdk .FieldConfigOverrideProperty {
ID : "color" ,
Value : map [string ]string {
"mode" : "fixed" ,
"fixedColor" : color ,
},
})
}
}
func NegativeY () OverrideOption {
return func (field *sdk .FieldConfigOverride ) {
field .Properties = append (field .Properties ,
sdk .FieldConfigOverrideProperty {
ID : "custom.transform" ,
Value : "negative-Y" ,
})
}
}
func AxisPlacement (placement axis .PlacementMode ) OverrideOption {
return func (field *sdk .FieldConfigOverride ) {
field .Properties = append (field .Properties ,
sdk .FieldConfigOverrideProperty {
ID : "custom.axisPlacement" ,
Value : string (placement ),
})
}
}
func Stack (mode StackMode ) OverrideOption {
return func (field *sdk .FieldConfigOverride ) {
field .Properties = append (field .Properties ,
sdk .FieldConfigOverrideProperty {
ID : "custom.stacking" ,
Value : map [string ]interface {}{
"group" : false ,
"mode" : string (mode ),
},
})
}
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .